from flask import current_app
from redis import StrictRedis
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from info import create_app, db

app = create_app('test')

# flask_script数据迁移
manager = Manager(app)
Migrate(app, db)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    # app.run(debug=True)
    # 启动项Config类开启debug模式

    # 实验redis是否链接成功
    # try:
    #     # 创建StrictRedis对象，与redis服务器建⽴连接
    #     sr = StrictRedis()
    #     # 添加键name，值为itheima
    #     result = sr.set('name', 'xiaoming')
    #     # 输出响应结果，如果添加成功则返回True，否则返回False
    #     print(result)
    # except Exception as e:
    #     print(e)

    # flask_script数据迁移
    # app.run()
    # print(app.url_map)
    manager.run()
